package com.xiaomi.service.impl;


import com.xiaomi.dao.ItemDao;
import com.xiaomi.dao.impl.ItemDaoImpl;
import com.xiaomi.entity.Item;
import com.xiaomi.service.ItemService;

import java.util.List;

/**
 * TODO
 *
 * @author jy
 * @date 2021/5/26
 */
public class ItemServiceImpl implements ItemService {

    private final ItemDao itemDao = new ItemDaoImpl();

    @Override
    public int insertItem(Item item) {
        try {
            return itemDao.insertItem(item);
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }

    @Override
    public List<Item> itemList(String oid) {
        if (oid != null && !"".equals(oid)) {
            try {
                return itemDao.itemList(oid);
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }
        return null;
    }
}
